package WordFrequent;

import com.sun.istack.internal.Nullable;
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.util.*;

public class measure {
    public static void step0(File file) {
        String words = "";
        words = Step.ReadFile(file);
        int num  = Zerostep.count(words);
        Zerostep.Wordsnumber(words);
        System.out.println("字母     "+"次数     "+"频率");
            Zerostep.sort(num);
    }

    public static void step1(File file) {
        String words = "";
            words = Step.ReadFile(file);
            Onestep.print1(words);
    }



    public static void step2(String path) {
        readfile.getFile(path);
    }

    public static void step3(String path ) {
        readfile.getFiles(path);
    }

    public static void step4(File file, @Nullable Integer n){
        String words = "";
           words   =  Step.ReadFile(file);
        List<Map.Entry<String,Integer>> list  =     Onestep.sort(words);
        if (n == null)
            n = list.size();

        for (int i = 0; i < n; i++) {
            System.out.printf("%s \t %d \t\n", list.get(i).getKey(), list.get(i).getValue());
        }

    }

    public static void step5(File file) {
            String words = "";
            String Stopwords = "";
            words = Step.ReadFile(file);
            Stopwords = Step.ReadFile(new File("D:\\大三上\\软件工程\\project\\sum of word\\word\\stopwords.txt"));
        List<Map.Entry<String,Integer>> list1  =     Onestep.sort(words);
            List<String> list2 = Step.sort(Stopwords);
            list1 =    secondstep.delete(list1,list2);
                Step.printf(list1);
    }
        //将所有动词形式都转换为原型
    public static void step6(File file) {
               String book = Step.ReadFile(file);
               String v    = Step.ReadFile(new File("D:\\大三上\\软件工程\\project\\sum of word\\word\\v.txt"));
        List<Map.Entry<String,Integer>> list =       fourstep.deal(book,v);
            Step.printf(list);
    }
}

